<div class="loading-container"><div class="loader"></div></div>

<div class="wrapper wrapper-radius wrapper-dashboard wrapper-transparent">
	<!-- list data wrapper -->
	<div class="result-wrapper">
    	<div class="content-wrapper">
     	<div class="content-body">
     		<!--  -->
     		<div class="row">
     			<div class="col-lg-9 col-md-9 col-sm-9 col-xs-12">
     				<div class="row">
     					<div class="col-xs-12">
     						<div class="widget">
	                <div class="widget-header bordered-bottom bordered-orange">
	                  <i class="widget-icon fa fa-tasks orange"></i>
	                  <span class="widget-caption orange">当天试听学员</span>
	                </div>
	                <div class="widget-body">
	                	<table data-ajax="handlerSearch" 
		             					 data-method="post" 
												 	 data-id-field="id" 
												 	 data-unique-id="id" 
													 data-check-on-init="true" 
													 data-click-to-select="true" 
													 data-side-pagination="server" 
													 data-mobile-responsive="true" 
													 data-event-onload="handlerSuccess"
													 data-form-search="#search-form-audition" id="table-audition" class="bootstrap-table">
											<thead>
												<tr>
													<th data-field="id" data-visible="false">ID</th>
													<th data-field="student" 		data-align="center" >学员</th>
													<th data-field="parent" 		data-align="center" >家长</th>
													<th data-field="mobile" 		data-align="center" >手机</th>
													<th data-field="classes" 		data-align="center" >试听班级</th>
													<!-- <th data-field="operator" 	data-align="center" data-formatter="renderBespoke" data-table-target="audition">操作</th> -->
												</tr>
											</thead>
										</table>
	                </div>
              	</div>
     					</div>
     				</div>
     			</div>
     			
     			<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
     				<div class="row">
     					<!-- 本月到课率 -->
     					<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
	              <div class="databox box-shadow bg-white radius-bordered">
	                <div class="databox-left bg-orange">
	                  <div class="databox-piechart">
                    	<div class="easypiechart" data-percent="0" data-size="47" data-animate="500">
                 			 		<span class="white font-90" data-epc-percent="本月到课率">0%</span>
                    	</div>
	                  </div>
	                </div>
	                <div class="databox-right">
	                  <span class="databox-number orange" data-epc-count="本月到课率">0</span>
	                  <div class="databox-text darkgray">本月到课率</div>
	                  <div class="databox-stat orange radius-bordered">
                    	<i class="stat-icon icon-lg fa fa-user-plus"></i>
	                  </div>
	                </div>
	              </div>
	        		</div>
	        	</div>
	        	<div class="row">
	        		<!-- 本月电访数 -->
	        		<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
	              <div class="databox box-shadow bg-white radius-bordered">
	                <div class="databox-left bg-yellow-deep">
	                  <div class="databox-piechart">
                    	<div class="easypiechart" data-percent="0" data-size="47" data-animate="500">
                 			 		<span class="white font-90" data-epc-percent="本月电访数">0%</span>
                    	</div>
	                  </div>
	                </div>
	                <div class="databox-right">
	                  <span class="databox-number yellow-deep" data-epc-count="本月电访数">0</span>
	                  <div class="databox-text darkgray">本月电访数</div>
	                  <div class="databox-stat yellow-deep radius-bordered">
                    	<i class="stat-icon icon-lg fa fa-tasks"></i>
	                  </div>
	                </div>
	              </div>
	        		</div>
	        	</div>
     			</div>
     		</div>
     		
     		<div class="row">
     			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
     				<div class="dashboard-box radius-bordered">
							<div class="box-header">
								<div class="headline">本月排班表</div>
							</div>
							<div class="box-content">
								<div class="box-tabs">
									<div class="tabable">
										<ul class="nav nav-tabs tabs-flat nav-justified">
											<li class="active">
												<a data-toggle="tab" href="#tab-schedule-ee"> 早教 </a>
											</li>
											<li>
												<a data-toggle="tab" href="#tab-schedule-dc"> 托班 </a>
											</li>
										</ul>
										<div class="tab-content tabs-flat">
											<div class="tab-pane active" id="tab-schedule-ee">
												<div id="querybar">
								     			<div class="btn-group">
												    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
								   						<i class="glyphicon glyphicon-calendar"></i> 班级筛选 <span class="caret"></span>
													  </button>
													  <ul class="dropdown-menu" id="classes-query"></ul>
												  </div>
												</div>
				             		<table data-search="true" 
											 				 data-toolbar="#querybar" 
				             					 data-check-on-init="true" 
															 data-click-to-select="true" 
															 data-mobile-responsive="true" 
															 data-event-onload="" id="table-schedule" class="bootstrap-table">
													<thead>
														<tr>
															<th data-field="课程" 	data-align="center" data-width="100" data-align="center" >课程</th>
															<th data-field="周一" 	data-align="center" data-width="100" data-formatter="renderClasses">周一</th>
															<th data-field="周二" 	data-align="center" data-width="100" data-formatter="renderClasses">周二</th>
															<th data-field="周三"	data-align="center" data-width="100" data-formatter="renderClasses">周三</th>
															<th data-field="周四"	data-align="center" data-width="100" data-formatter="renderClasses">周四</th>
															<th data-field="周五"	data-align="center" data-width="100" data-formatter="renderClasses">周五</th>
															<th data-field="周六"	data-align="center" data-width="100" data-formatter="renderClasses">周六</th>
															<th data-field="周日"	data-align="center" data-width="100" data-formatter="renderClasses">周日</th>
														</tr>
													</thead>
												</table>
											</div>
											<div class="tab-pane" id="tab-schedule-dc">
												<table data-ajax="handlerSearch" 
						         					 data-method="post" 
														 	 data-id-field="id" 
														 	 data-unique-id="id" 
															 data-pagination="true" 
															 data-check-on-init="true" 
															 data-click-to-select="false" 
															 data-side-pagination="server" 
															 data-mobile-responsive="true" 
															 data-event-onload="handlerSuccess" 
															 data-form-search=".search-form-classes" id="table-classes" class="bootstrap-table">
													<thead>
														<tr>
															<th data-checkbox="true"></th>
															<th data-field="id" data-visible="false" data-switchable="false">ID</th>
															<th data-field="name" 			data-align="center" >班级名称</th>
															<th data-field="createDate" data-align="center" >开班时间</th>
															<th data-field="teacher" 		data-align="center" >负责老师</th>
															<th data-field="room" 			data-align="center" >所在教室</th>
															<th data-field="students" 	data-align="center" >学员数</th>
															<th data-field="toplimit" 	data-align="center" >学员上限</th>
															<th data-field="operator" 	data-align="center" data-width="80" data-formatter="renderOperator" data-table-target="classes">操作</th>
														</tr>
													</thead>
												</table>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
     			</div>
     		</div>
     		
     	</div>
   	</div>
	</div>
	
	<!-- form editor wrapper -->
	<div class="editor-wrapper">
		
	</div>
</div>
<!-- PAGE CONTENT END =============================================== -->

<!-- 提交 表单 ========================================================= -->
<form id="editor-form-leave" action="/miwawa/{dbname}/common/save" method="post" 
			name="com.app.miwawa.api.eam.entity.StudentLeave">
			<input type="hidden" name="bean['parent']" id="parent">
			<input type="hidden" name="bean['status']" value="0">
			<input type="hidden" name="bean['invalid']" value="F">
</form>
<!-- 查询表单 ========================================================= -->
<form id="search-form-audition" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.eam.entity.view.StudentAudition">
			<input type="hidden" name="classes" value="0" data-search-group="and" data-search-operation="IS_NOT_NULL">
			<input type="hidden" data-search-sort="promiseDate" data-search-order="desc">
</form>
<form id="search-form-classes" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.eam.entity.view.ClassesView"
			data-template-target=".editor-body-classes" 
			data-template-id="#view-classes-template-ee" 
			data-on-load-success="handlerLoadered"
			data-template-path="/miwawa/content/eam/classes/template.html">
			<input type="hidden" name="id" value="0" data-search-group="and" data-search-operation="EQ">
</form>
<form class="search-form-classes" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.eam.entity.view.ClassesView">
			<input type="hidden" name="type" value="托班" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="status" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
</form>
<form class="search-form-teacher" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.eam.entity.view.TeacherView">
			<input type="hidden" name="status" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="createDate" data-search-order="desc">
</form>

<!-- Javascript ===================================================== -->
<script src="/miwawa/resources/lib/miwawa/1.0.2/js/core/requirejs/require.js"></script>

<script type="text/javascript">
<!--
	jQuery(function(){
		var dashboad = '/miwawa/resources/lib/miwawa/1.0.2/js/core/module/app/dashboard.js?'+Date.parse(new Date());
		var simplejs = '/miwawa/resources/lib/miwawa/1.0.2/js/core/module/app/simple.js?'+Date.parse(new Date());
		require([dashboad, simplejs], function(dashboard, simple){
			dashboard.teacher(); simple(['registerForm','registerWidget']);
		});
	});
	
	// 筛选班级名称
	function handlerQuery(trigger){
		jQuery("#table-schedule").bootstrapTable('refreshOptions',{"searchText":trigger.innerText});
	}
	
	// 渲染班级列表操作列
	function renderOperator(value, row, index){
		switch(this.tableTarget){
			case "classes":
				return "<a class='btn btn-primary btn-xs btn-table-op' onclick='handlerCreate(this, \""+row.id+"\")' data-table-source='#table-classes' data-editor-path='/miwawa/content/portal/classes/' data-editor-page='edit-dc.html'> 管理 </a>"
			case "teacher":
				return	row.id == "edit" ? value : 
								"<a class='btn btn-info	  btn-xs btn-table-op' onclick='handlerUpdate(this, \""+index+"\")' data-table-source='#table-teacher' data-rowdata='"+JSON.stringify(row)+"' data-toggle='tooltip' data-placement='top' title='修改'> <i class='ion-compose'></i> </a>" 
							+ "<a class='btn btn-danger btn-xs btn-table-op' onclick='handlerDelete(this, \""+index+"\")' data-table-source='#table-teacher' data-rowdata='"+JSON.stringify(row)+"' data-toggle='tooltip' data-placement='top' title='删除'> <i class='fa fa-trash'></i> </a>";
		}
	}
	
	function renderClasses(value, row, index){
		var result = "";
		if(value){
			var classes = value.split(",");
			for(var i in classes){
				var array = classes[i].split(";");
				result += "<a class='btn btn-default btn-xs btn-classes' onclick='handlerCreate(this,\""+array[0]+"\");' data-notable='true' data-table-source='#table-schedule' data-editor-path='/miwawa/content/portal/classes/' data-editor-page='edit-ee.html'>" + array[1] + "</a>";
			}
		}
		return result;
	}
	
	// 渲染老师选择列表的班级数
	function renderCount(value, row, index){
		return '<a href="javascript:void(0);"><span class="badge bg-orange">'+value+'</span></a>';
	}
	
	// 渲染班级学员列表的当天签到情况
	function renderStatus(value, row, index){
		return value ? '<a class="btn '+(value == '上课'?'btn-success':'btn-danger')+' btn-xs">'+value+","+row.checkDetail+'</a>' : value;
	}
	
	function renderBespoke(value, row, index){
		var operator = "";
		switch (this.tableTarget) {
			case "audition":
			 	operator = "<a class='btn btn-primary btn-xs btn-table-op' onclick='handlerCreate(this,\""+row.id+"\")' data-table-source='#table-customer' data-editor-page='edit.html'> 签到 </a>";
			break;
		}
		return operator;
	}
//-->
</script>